#ifndef RECTEDGES_HPP
#define RECTEDGES_HPP

#include "structEdgesBase.hpp"
#include "rectMeshFunctions.hpp"

namespace hms {

template<>
class EdgesTraits<RectEdges>
{
public:
	using MeshType = RectMesh;
	using NormalsReturnType = RectNormalsType;

	template<typename T>
	using ReplicateDynamic = Eigen::Replicate<T,Dynamic,Dynamic>;


	using VectorBlock = Eigen::Block<const ArrayXs, Dynamic, 1, false>;

	using LengthsReturnType = Eigen::CwiseNullaryOp<EigenCustom::ConcatFunctor<
		EigenCustom::Direction::vertical,
		Eigen::Reshaped<const ReplicateDynamic<VectorBlock>, Dynamic, 1>,
		Eigen::Reshaped<const ReplicateDynamic<Eigen::Transpose<VectorBlock>>, Dynamic, 1>
	>, ArrayXs>;
};


class RectEdges : public StructEdgesBase<RectEdges>
{
public:
	using Traits = EdgesTraits<RectEdges>;
	using NormalsReturnType = typename Traits::NormalsReturnType;
	using LengthsReturnType = typename Traits::LengthsReturnType;
public:
	RectEdges() = default;
	RectEdges( const RectMesh& );
private:
	auto lengthsImp() const -> LengthsReturnType;
	auto normalsImp() const -> NormalsReturnType;

	friend EdgesBase;
};

} // namespace hms

#endif